package com.wptk.filemanager.ui;

import android.view.View;
import android.webkit.WebView;
import android.widget.CheckedTextView;
import android.widget.RelativeLayout;

import androidx.appcompat.widget.Toolbar;

import com.wptk.filemanager.R;
import com.wptk.filemanager.ui.base.BaseActivity;

public class ProtocolActivity extends BaseActivity {

    private View statusBarDimen;
    private RelativeLayout All;
    private Toolbar toolbar;
    private CheckedTextView cbAll;
    private WebView web;

    public static final String TYPE = "type";
    public static final int TERMS_OF_SERVERS = 1;
    public static final int PRIVACY_POLICY = 2;
    public static final String SERVICE_URL = "https://www.filesmanager.live/backupcopy/filesmanager-s-1.html";
    public static final String PROTOCOL_URL = "https://www.filesmanager.live/backupcopy/filesmanager-p-2.html";

    @Override
    protected int getLayoutId() {
        return R.layout.activity_protocol;
    }

    @Override
    protected void initView() {
        int type = getIntent().getIntExtra("type", -1);
        statusBarDimen = (View) findViewById(R.id.status_bar_dimen);
        All = (RelativeLayout) findViewById(R.id.All);
        toolbar = (Toolbar) findViewById(R.id.toolbar);
        cbAll = (CheckedTextView) findViewById(R.id.cb_all_toolbar);
        web = (WebView) findViewById(R.id.web);

        switch (type){
            case TERMS_OF_SERVERS:
                web.loadUrl(SERVICE_URL);
                toolbar.setTitle(getString(R.string.terms_of_service));
                break;
            case PRIVACY_POLICY:
                web.loadUrl(PROTOCOL_URL);
                toolbar.setTitle(getString(R.string.privacy_policy));
                break;
            default:
                break;
        }
    }

    @Override
    protected void initEvent() {

    }
}